package cn.maihe.elg.operation.supports.electronicseal.kt.cloudsign.service;

import cn.maihe.elg.operation.supports.electronicseal.kt.KtConfig;
import cn.maihe.elg.operation.supports.electronicseal.kt.cloudsign.BaseKtCloudSignService;
import cn.maihe.elg.operation.supports.electronicseal.kt.cloudsign.dto.GetAuthTokenReqDTO;
import cn.maihe.elg.operation.supports.electronicseal.kt.cloudsign.dto.GetAuthTokenRespDTO;
import cn.maihe.elg.operation.supports.electronicseal.kt.cloudsign.enums.CloudSignInterfaceEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description 调用该接口发送用户授权验证码
 * @Author WJH
 * @Date 2022/09/19
 */
@Service
@Slf4j
public class GetAuthTokenService extends BaseKtCloudSignService<GetAuthTokenReqDTO, GetAuthTokenRespDTO> {
    public GetAuthTokenService(KtConfig ktConfig) {
        super(ktConfig);
    }


    @Override
    protected CloudSignInterfaceEnum serviceName() {
        return CloudSignInterfaceEnum.getAuthToken;
    }

    /**
     * 授权手机号码获取pdf签章token
     */
    public List<GetAuthTokenRespDTO.TokenInfo> getAutoToken(String opId, String smsCode) {

        GetAuthTokenReqDTO reqDTO = new GetAuthTokenReqDTO();
        reqDTO.setOpId(opId);
        reqDTO.setCode(smsCode);

        GetAuthTokenRespDTO respDTO = this.doService(opId, reqDTO);
        return respDTO.getTokenArr();
    }


}
